package com.neuedu.javase.collections;

/**
 * @auth 金山老师
 * title:   书籍代码
 * creatime: 2022-09-30 10:41
 * 描述 :
 */
public class User implements Comparable<User> {
    private String name;
    private Integer age;

//    public User(void) {
//    }

    public User(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public int compareTo(User o) {
        return this.age  - o.age;
    }


    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
